package au.com.evoCoach.domain;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.OneToOne;

@Entity
public class PlayerScore {
	private int id;
	private Player player;
	private Round round;
	private int score;
	
	public PlayerScore() {}
	
	public PlayerScore(Player player, Round round, int score) {
		this.player = player;
		this.round = round;
		this.score = score;
	}

	@Id
	@GeneratedValue
	@Column
	public int getId() {
		return id;
	}
	
	public void setId(int id) {
		this.id = id;
	}
	
	@OneToOne
    @JoinColumn(name="round")
	public Round getRound() {
		return round;
	}

	public void setRound(Round round) {
		this.round = round;
	}
	
	public int getScore() {
		return score;
	}

	public void setScore(int score) {
		this.score = score;
	}

	@OneToOne(cascade=CascadeType.ALL)
    @JoinColumn(name="playerId")
	public Player getPlayer() {
		return player;
	}
	
	public void setPlayer(Player player) {
		this.player = player;
	}
	
}
